{*if count($role->getErrors())}
	<div class="errors">
		{foreach $role->getErrors() as $error}
			<div class="error">{$error}</div>
		{/foreach}
	</div>
{/if*}
<form action="?module=users&action=role_save" method="POST">
	<input type="hidden" id="role_id" name="role[id]" value="{$role->id}" />
	<div class="row">
		<label for="role_title">Название</label>
		<input type="text" id="role_title" name="role[title]" value="{$role->title}" />
	</div>
	<div class="row">
		<label for="role_description">Описание</label>
		<textarea id="role_description" name="role[description]" cols="30" rows="10" class="redactor">{/strip}{$role->description}{strip}</textarea>
	</div>
	<table class="list">
		<tr>
			<th style="text-align: left;">Имя модуля</th>
			<th class="_20">Чит.</th>
			<th class="_20">Ред.</th>
			<th class="_20">Публ.</th>
			<th class="_20">Удл.</th>
		</tr>
		
		{foreach $modules as $module}
			<tr>
				<td>
					{$module->title}
				</td>
				<td class="center">
					<input type="checkbox"{if $role->access($module->name, 'r')} checked="checked"{/if} name="roles_modules[{$module->id}][r]" value="1" class="_rea_" />
				</td>
				<td class="center">
					<input type="checkbox"{if $role->access($module->name, 'c')} checked="checked"{/if} name="roles_modules[{$module->id}][c]" value="1" class="_edi_" />
				</td>
				<td class="center">
					<input type="checkbox"{if $role->access($module->name, 'p')} checked="checked"{/if} name="roles_modules[{$module->id}][p]" value="1" class="_pub_" />
				</td>
				<td class="center">
					<input type="checkbox"{if $role->access($module->name, 'd')} checked="checked"{/if} name="roles_modules[{$module->id}][d]" value="1" class="_del_" />
				</td>
			</tr>
		{/foreach}

		<tfoot>
			<tr>
				<td></td>
				<td class="center"><input type="checkbox" id="name" name="name" class="_checkbox_ _rea_"/></td>
				<td class="center"><input type="checkbox" id="name" name="name" class="_checkbox_ _edi_"/></td>
				<td class="center"><input type="checkbox" id="name" name="name" class="_checkbox_ _pub_"/></td>
				<td class="center"><input type="checkbox" id="name" name="name" class="_checkbox_ _del_"/></td>
			</tr>
		</tfoot>
	</table>
	<div class="buttons">
		<input type="submit" value="Сохранить" class="save"/>
		<input type="submit" value="Применить" class="apply" name="apply"/>
		<input type="reset" value="Отменить" class="cancel" onclick="history.go(-1)"/>
	</div>
</form>